HermesToken
HermesToken.sol
This contract is a representation of IERC20 Hermes
pragma solidity >=0.8.0 <0.9.0;
contract Hermes is
Ownable,
ERC20("Hermes", "HRMS"),
ERC20Capped(30000000 gwei),
AccessControl
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
Setup Functions
constructor() {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(MINTER_ROLE, msg.sender);
_grantRole(BURNER_ROLE, msg.sender);
}
Externally Accessible Functions
burn
function burn(address _account, uint256 amount)
public
onlyRole(BURNER_ROLE)
{
_burn(_account, amount);
}
mint
function mint(address _account, uint256 _amount)
public
onlyRole(MINTER_ROLE)
returns(bool)
{
return _mint(_account, _amount);
}
grantMinterRole
function grantMinterRole(address _account)
public
onlyRole(DEFAULT_ADMIN_ROLE)
{
_grantRole(MINTER_ROLE, _account);
}
grantBurnerRole
function grantBurnerRole(address _account)
public
onlyRole(DEFAULT_ADMIN_ROLE)
{
_grantRole(BURNER_ROLE, _account);
}
revokeMinterRole
function revokeMinterRole(address _account)
public
onlyRole(DEFAULT_ADMIN_ROLE)
{
_revokeRole(MINTER_ROLE, _account);
}
revokeBurnerRole
function revokeBurnerRole(address _account)
public
onlyRole(DEFAULT_ADMIN_ROLE)
{
_revokeRole(BURNER_ROLE, _account);
}
transferOwnership
function transferOwnership(address newOwner)
public
virtual
override
onlyOwner
{
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_grantRole(DEFAULT_ADMIN_ROLE, newOwner);
_transferOwnership(newOwner);
}
Internal functions
_mint
function _mint(address account, uint256 amount)
internal
virtual
override(ERC20, ERC20Capped)
returns(bool)
{
return super._mint(account, amount);
}